//Dom7
;(function (window, undefined) {
    var Dom7 = function (arr) {
        var _this = this, i = 0;
        // Create array-like object
        for (i = 0; i < arr.length; i++) {
            _this[i] = arr[i];
        }
        _this.length = arr.length;
        // Return collection with methods
        return this;
    };
    var $ = function (selector, context) {
        var arr = [], i = 0;
        if (selector && !context) {
            if (selector instanceof Dom7) {
                return selector;
            }
        }
        if (selector) {
            // String
            if (typeof selector === 'string') {
                var els, tempParent, html = selector.trim();
                if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
                    var toCreate = 'div';
                    if (html.indexOf('<li') === 0) toCreate = 'ul';
                    if (html.indexOf('<tr') === 0) toCreate = 'tbody';
                    if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
                    if (html.indexOf('<tbody') === 0) toCreate = 'table';
                    if (html.indexOf('<option') === 0) toCreate = 'select';
                    tempParent = document.createElement(toCreate);
                    tempParent.innerHTML = selector;
                    for (i = 0; i < tempParent.childNodes.length; i++) {
                        arr.push(tempParent.childNodes[i]);
                    }
                } else {
                    if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
                        // Pure ID selector
                        els = [document.getElementById(selector.split('#')[1])];
                    } else {
                        // Other selectors
                        els = (context || document).querySelectorAll(selector);
                    }
                    for (i = 0; i < els.length; i++) {
                        if (els[i]) arr.push(els[i]);
                    }
                }
            }
            // Node/element
            else if (selector.nodeType || selector === window || selector === document) {
                arr.push(selector);
            }
            //Array of elements or instance of Dom
            else if (selector.length > 0 && selector[0].nodeType) {
                for (i = 0; i < selector.length; i++) {
                    arr.push(selector[i]);
                }
            }
        }
        return new Dom7(arr);
    };
    Dom7.prototype = {
        // Classes and attriutes
        addClass: function (className) {
            if (typeof className === 'undefined') {
                return this;
            }
            var classes = className.split(' ');
            for (var i = 0; i < classes.length; i++) {
                for (var j = 0; j < this.length; j++) {
                    this[j].classList.add(classes[i]);
                }
            }
            return this;
        },
        removeClass: function (className) {
            var classes = className.split(' ');
            for (var i = 0; i < classes.length; i++) {
                for (var j = 0; j < this.length; j++) {
                    this[j].classList.remove(classes[i]);
                }
            }
            return this;
        },
        hasClass: function (className) {
            if (!this[0]) return false;
            else return this[0].classList.contains(className);
        },
        toggleClass: function (className) {
            var classes = className.split(' ');
            for (var i = 0; i < classes.length; i++) {
                for (var j = 0; j < this.length; j++) {
                    this[j].classList.toggle(classes[i]);
                }
            }
            return this;
        },
        attr: function (attrs, value) {
            if (arguments.length === 1 && typeof attrs === 'string') {
                // Get attr
                if (this[0]) return this[0].getAttribute(attrs);
                else return undefined;
            } else {
                // Set attrs
                for (var i = 0; i < this.length; i++) {
                    if (arguments.length === 2) {
                        // String
                        this[i].setAttribute(attrs, value);
                    } else {
                        // Object
                        for (var attrName in attrs) {
                            this[i][attrName] = attrs[attrName];
                            this[i].setAttribute(attrName, attrs[attrName]);
                        }
                    }
                }
                return this;
            }
        },
        removeAttr: function (attr) {
            for (var i = 0; i < this.length; i++) {
                this[i].removeAttribute(attr);
            }
            return this;
        },
        data: function (key, value) {
            if (typeof value === 'undefined') {
                // Get value
                if (this[0]) {
                    var dataKey = this[0].getAttribute('data-' + key);
                    if (dataKey) return dataKey;
                    else if (this[0].dom7ElementDataStorage && (key in this[0].dom7ElementDataStorage)) return this[0].dom7ElementDataStorage[key];
                    else return undefined;
                } else return undefined;
            } else {
                // Set value
                for (var i = 0; i < this.length; i++) {
                    var el = this[i];
                    if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
                    el.dom7ElementDataStorage[key] = value;
                }
                return this;
            }
        },
        // Transforms
        transform: function (transform) {
            for (var i = 0; i < this.length; i++) {
                var elStyle = this[i].style;
                elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
            }
            return this;
        },
        transition: function (duration) {
            if (typeof duration !== 'string') {
                duration = duration + 'ms';
            }
            for (var i = 0; i < this.length; i++) {
                var elStyle = this[i].style;
                elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
            }
            return this;
        },
        // //Events
        on: function (eventName, targetSelector, listener, capture) {
            function handleLiveEvent(e) {
                var target = e.target;
                if ($(target).is(targetSelector)) listener.call(target, e);
                else {
                    var parents = $(target).parents();
                    for (var k = 0; k < parents.length; k++) {
                        if ($(parents[k]).is(targetSelector)) listener.call(parents[k], e);
                    }
                }
            }

            var events = eventName.split(' ');
            var i, j;
            for (i = 0; i < this.length; i++) {
                if (typeof targetSelector === 'function' || targetSelector === false) {
                    // Usual events
                    if (typeof targetSelector === 'function') {
                        listener = arguments[1];
                        capture = arguments[2] || false;
                    }
                    for (j = 0; j < events.length; j++) {
                        this[i].addEventListener(events[j], listener, capture);
                    }
                } else {
                    //Live events
                    for (j = 0; j < events.length; j++) {
                        if (!this[i].dom7LiveListeners) this[i].dom7LiveListeners = [];
                        this[i].dom7LiveListeners.push({listener: listener, liveListener: handleLiveEvent});
                        this[i].addEventListener(events[j], handleLiveEvent, capture);
                    }
                }
            }

            return this;
        },
        off: function (eventName, targetSelector, listener, capture) {
            var events = eventName.split(' ');
            for (var i = 0; i < events.length; i++) {
                for (var j = 0; j < this.length; j++) {
                    if (typeof targetSelector === 'function' || targetSelector === false) {
                        // Usual events
                        if (typeof targetSelector === 'function') {
                            listener = arguments[1];
                            capture = arguments[2] || false;
                        }
                        this[j].removeEventListener(events[i], listener, capture);
                    } else {
                        // Live event
                        if (this[j].dom7LiveListeners) {
                            for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {
                                if (this[j].dom7LiveListeners[k].listener === listener) {
                                    this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);
                                }
                            }
                        }
                    }
                }
            }
            return this;
        },
        once: function (eventName, targetSelector, listener, capture) {
            var dom = this;
            if (typeof targetSelector === 'function') {
                targetSelector = false;
                listener = arguments[1];
                capture = arguments[2];
            }

            function proxy(e) {
                listener(e);
                dom.off(eventName, targetSelector, proxy, capture);
            }

            dom.on(eventName, targetSelector, proxy, capture);
        },
        trigger: function (eventName, eventData) {
            for (var i = 0; i < this.length; i++) {
                var evt;
                try {
                    evt = new window.CustomEvent(eventName, {detail: eventData, bubbles: true, cancelable: true});
                } catch (e) {
                    evt = document.createEvent('Event');
                    evt.initEvent(eventName, true, true);
                    evt.detail = eventData;
                }
                this[i].dispatchEvent(evt);
            }
            return this;
        },
        transitionEnd: function (callback) {
            var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
                i, j, dom = this;

            function fireCallBack(e) {
                /*jshint validthis:true */
                if (e.target !== this) return;
                callback.call(this, e);
                for (i = 0; i < events.length; i++) {
                    dom.off(events[i], fireCallBack);
                }
            }

            if (callback) {
                for (i = 0; i < events.length; i++) {
                    dom.on(events[i], fireCallBack);
                }
            }
            return this;
        },
        // Sizing/Styles
        width: function () {
            if (this[0] === window) {
                return window.innerWidth;
            } else {
                if (this.length > 0) {
                    return parseFloat(this.css('width'));
                } else {
                    return null;
                }
            }
        },
        outerWidth: function (includeMargins) {
            if (this.length > 0) {
                if (includeMargins)
                    return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));
                else
                    return this[0].offsetWidth;
            } else return null;
        },
        height: function () {
            if (this[0] === window) {
                return window.innerHeight;
            } else {
                if (this.length > 0) {
                    return parseFloat(this.css('height'));
                } else {
                    return null;
                }
            }
        },
        outerHeight: function (includeMargins) {
            if (this.length > 0) {
                if (includeMargins)
                    return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));
                else
                    return this[0].offsetHeight;
            } else return null;
        },
        offset: function () {
            if (this.length > 0) {
                var el = this[0];
                var box = el.getBoundingClientRect();
                var body = document.body;
                var clientTop = el.clientTop || body.clientTop || 0;
                var clientLeft = el.clientLeft || body.clientLeft || 0;
                var scrollTop = window.pageYOffset || el.scrollTop;
                var scrollLeft = window.pageXOffset || el.scrollLeft;
                return {
                    top: box.top + scrollTop - clientTop,
                    left: box.left + scrollLeft - clientLeft
                };
            } else {
                return null;
            }
        },
        css: function (props, value) {
            var i;
            if (arguments.length === 1) {
                if (typeof props === 'string') {
                    if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
                } else {
                    for (i = 0; i < this.length; i++) {
                        for (var prop in props) {
                            this[i].style[prop] = props[prop];
                        }
                    }
                    return this;
                }
            }
            if (arguments.length === 2 && typeof props === 'string') {
                for (i = 0; i < this.length; i++) {
                    this[i].style[props] = value;
                }
                return this;
            }
            return this;
        },

        //Dom manipulation
        each: function (callback) {
            for (var i = 0; i < this.length; i++) {
                callback.call(this[i], i, this[i]);
            }
            return this;
        },
        html: function (html) {
            if (typeof html === 'undefined') {
                return this[0] ? this[0].innerHTML : undefined;
            } else {
                for (var i = 0; i < this.length; i++) {
                    this[i].innerHTML = html;
                }
                return this;
            }
        },
        is: function (selector) {
            if (!this[0]) return false;
            var compareWith, i;
            if (typeof selector === 'string') {
                var el = this[0];
                if (el === document) return selector === document;
                if (el === window) return selector === window;

                if (el.matches) return el.matches(selector);
                else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
                else if (el.mozMatchesSelector) return el.mozMatchesSelector(selector);
                else if (el.msMatchesSelector) return el.msMatchesSelector(selector);
                else {
                    compareWith = $(selector);
                    for (i = 0; i < compareWith.length; i++) {
                        if (compareWith[i] === this[0]) return true;
                    }
                    return false;
                }
            } else if (selector === document) return this[0] === document;
            else if (selector === window) return this[0] === window;
            else {
                if (selector.nodeType || selector instanceof Dom7) {
                    compareWith = selector.nodeType ? [selector] : selector;
                    for (i = 0; i < compareWith.length; i++) {
                        if (compareWith[i] === this[0]) return true;
                    }
                    return false;
                }
                return false;
            }

        },
        index: function () {
            if (this[0]) {
                var child = this[0];
                var i = 0;
                while ((child = child.previousSibling) !== null) {
                    if (child.nodeType === 1) i++;
                }
                return i;
            } else return undefined;
        },
        eq: function (index) {
            if (typeof index === 'undefined') return this;
            var length = this.length;
            var returnIndex;
            if (index > length - 1) {
                return new Dom7([]);
            }
            if (index < 0) {
                returnIndex = length + index;
                if (returnIndex < 0) return new Dom7([]);
                else return new Dom7([this[returnIndex]]);
            }
            return new Dom7([this[index]]);
        },
        append: function (newChild) {
            var i, j;
            for (i = 0; i < this.length; i++) {
                if (typeof newChild === 'string') {
                    var tempDiv = document.createElement('div');
                    tempDiv.innerHTML = newChild;
                    while (tempDiv.firstChild) {
                        this[i].appendChild(tempDiv.firstChild);
                    }
                } else if (newChild instanceof Dom7) {
                    for (j = 0; j < newChild.length; j++) {
                        this[i].appendChild(newChild[j]);
                    }
                } else {
                    this[i].appendChild(newChild);
                }
            }
            return this;
        },
        prepend: function (newChild) {
            var i, j;
            for (i = 0; i < this.length; i++) {
                if (typeof newChild === 'string') {
                    var tempDiv = document.createElement('div');
                    tempDiv.innerHTML = newChild;
                    for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {
                        this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
                    }
                    // this[i].insertAdjacentHTML('afterbegin', newChild);
                } else if (newChild instanceof Dom7) {
                    for (j = 0; j < newChild.length; j++) {
                        this[i].insertBefore(newChild[j], this[i].childNodes[0]);
                    }
                } else {
                    this[i].insertBefore(newChild, this[i].childNodes[0]);
                }
            }
            return this;
        },
        insertBefore: function (selector) {
            var before = $(selector);
            for (var i = 0; i < this.length; i++) {
                if (before.length === 1) {
                    before[0].parentNode.insertBefore(this[i], before[0]);
                } else if (before.length > 1) {
                    for (var j = 0; j < before.length; j++) {
                        before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
                    }
                }
            }
        },
        insertAfter: function (selector) {
            var after = $(selector);
            for (var i = 0; i < this.length; i++) {
                if (after.length === 1) {
                    after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
                } else if (after.length > 1) {
                    for (var j = 0; j < after.length; j++) {
                        after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
                    }
                }
            }
        },
        next: function (selector) {
            if (this.length > 0) {
                if (selector) {
                    if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return new Dom7([this[0].nextElementSibling]);
                    else return new Dom7([]);
                } else {
                    if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);
                    else return new Dom7([]);
                }
            } else return new Dom7([]);
        },
        nextAll: function (selector) {
            var nextEls = [];
            var el = this[0];
            if (!el) return new Dom7([]);
            while (el.nextElementSibling) {
                var next = el.nextElementSibling;
                if (selector) {
                    if ($(next).is(selector)) nextEls.push(next);
                } else nextEls.push(next);
                el = next;
            }
            return new Dom7(nextEls);
        },
        prev: function (selector) {
            if (this.length > 0) {
                if (selector) {
                    if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector)) return new Dom7([this[0].previousElementSibling]);
                    else return new Dom7([]);
                } else {
                    if (this[0].previousElementSibling) return new Dom7([this[0].previousElementSibling]);
                    else return new Dom7([]);
                }
            } else return new Dom7([]);
        },
        prevAll: function (selector) {
            var prevEls = [];
            var el = this[0];
            if (!el) return new Dom7([]);
            while (el.previousElementSibling) {
                var prev = el.previousElementSibling;
                if (selector) {
                    if ($(prev).is(selector)) prevEls.push(prev);
                } else prevEls.push(prev);
                el = prev;
            }
            return new Dom7(prevEls);
        },
        parent: function (selector) {
            var parents = [];
            for (var i = 0; i < this.length; i++) {
                if (selector) {
                    if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
                } else {
                    parents.push(this[i].parentNode);
                }
            }
            return $($.unique(parents));
        },
        parents: function (selector) {
            var parents = [];
            for (var i = 0; i < this.length; i++) {
                var parent = this[i].parentNode;
                while (parent) {
                    if (selector) {
                        if ($(parent).is(selector)) parents.push(parent);
                    } else {
                        parents.push(parent);
                    }
                    parent = parent.parentNode;
                }
            }
            return $($.unique(parents));
        },
        find: function (selector) {
            var foundElements = [];
            for (var i = 0; i < this.length; i++) {
                var found = this[i].querySelectorAll(selector);
                for (var j = 0; j < found.length; j++) {
                    foundElements.push(found[j]);
                }
            }
            return new Dom7(foundElements);
        },
        children: function (selector) {
            var children = [];
            for (var i = 0; i < this.length; i++) {
                var childNodes = this[i].childNodes;

                for (var j = 0; j < childNodes.length; j++) {
                    if (!selector) {
                        if (childNodes[j].nodeType === 1) children.push(childNodes[j]);
                    } else {
                        if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) children.push(childNodes[j]);
                    }
                }
            }
            return new Dom7($.unique(children));
        },
        remove: function () {
            for (var i = 0; i < this.length; i++) {
                if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
            }
            return this;
        },
        add: function () {
            var dom = this;
            var i, j;
            for (i = 0; i < arguments.length; i++) {
                var toAdd = $(arguments[i]);
                for (j = 0; j < toAdd.length; j++) {
                    dom[dom.length] = toAdd[j];
                    dom.length++;
                }
            }
            return dom;
        }
    };
    $.fn = Dom7.prototype;
    $.extend = $.fn.extend = function () {
        var options, name, src, copy, copyIsArray, clone,
            target = arguments[0] || {},
            i = 1,
            length = arguments.length,
            deep = false;
        if (typeof target === "boolean") {
            deep = target;
            target = arguments[1] || {};

            // 将i赋值为2，跳过前两个参数
            i = 2;
        }
        if (typeof target !== "object" && !$.isFunction(target)) {
            target = {};
        }
        if (length === i) {
            target = this;
            --i;
        }
        for (; i < length; i++) {
            if ((options = arguments[i]) != null) {
                for (name in options) {
                    src = target[name];
                    copy = options[name];
                    if (target === copy) {
                        continue;
                    }
                    if (deep && copy && ($.isPlainObject(copy) || (copyIsArray = $.isArray(copy)))) {
                        if (copyIsArray) {
                            copyIsArray = false;
                            clone = src && $.isArray(src) ? src : [];
                        } else {
                            clone = src && $.isPlainObject(src) ? src : {};
                        }
                        target[name] = $.extend(deep, clone, copy);
                    } else if (copy !== undefined) {
                        target[name] = copy;
                    }
                }
            }
        }
        return target;
    };
    $.extend({
        unique: function (arr) {
            var unique = [];
            for (var i = 0; i < arr.length; i++) {
                if (unique.indexOf(arr[i]) === -1) unique.push(arr[i]);
            }
            return unique;
        },
        isArray: function (arg) {
            if (typeof arg === 'object') {
                return Object.prototype.toString.call(arg) === '[object Array]';
            }
            return false;
        },
        likeArray: function (obj) {
            if (obj &&                                // o is not null, undefined, etc.
                typeof obj === 'object' &&            // o is an object
                isFinite(obj.length) &&               // o.length is a finite number
                obj.length >= 0 &&                    // o.length is non-negative
                obj.length === Math.floor(obj.length) &&  // o.length is an integer
                obj.length < 4294967296)              // o.length < 2^32
                return true;                        // Then o is array-like
            else
                return false;
        },
        isObject: function (arg) {
            if (typeof arg === 'object') {
                return Object.prototype.toString.call(arg) === '[object Object]';
            }
            return false;
        },
        isPlainObject: function (obj) {
            if (!this.isObject(obj) || obj.nodeType || this.isWindow(obj)) {
                return false;
            }
            try {
                if (obj.constructor && !UtilYgl.hasOwn.call(obj, "constructor") && !UtilYgl.hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
                    return false;
                }
            } catch (e) {
                return false;
            }
            var key;
            for (key in obj) {
            }
            return key === undefined || UtilYgl.hasOwn.call(obj, key);
        },
        isFunction: function (obj) {
            if (typeof obj === 'function') {
                return Object.prototype.toString.call(obj) === '[object Function]';
            }
            return false;
        },
        isWindow: function (obj) {
            return obj != null && obj == obj.window;
        },
        each: function (object, callback) {
            var i, key
            if (this.likeArray(object)) {
                for (i = 0; i < object.length; i++)
                    if (callback.call(object[i], i, object[i]) === false) return object;
            } else {
                for (key in object)
                    if (callback.call(object[key], key, object[key]) === false) return object;
            }
            return object;
        }
    });
    window.Dom7 = window.$$ = $;
})(window);
//ajax
;(function ($) {
    var jsonpID = +new Date(),
        document = window.document,
        key,
        name,
        rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
        scriptTypeRE = /^(?:text|application)\/javascript/i,
        xmlTypeRE = /^(?:text|application)\/xml/i,
        jsonType = 'application/json',
        htmlType = 'text/html',
        blankRE = /^\s*$/,
        originAnchor = document.createElement('a');

    originAnchor.href = window.location.href;

    if (window.JSON) $.parseJSON = JSON.parse;

    //class2type
    var class2type = {};
    $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (i, name) {
        class2type["[object " + name + "]"] = name.toLowerCase()
    });
    $.type = function type(obj) {
        return obj == null ? String(obj) :
            class2type[toString.call(obj)] || "object"
    }

    // trigger a custom event and return false if it was cancelled
    function triggerAndReturn(context, eventName, data) {
        // var event = $.Event(eventName)
        // $(context).trigger(event, data)
        // return !event.isDefaultPrevented()
    }

    // trigger an Ajax "global" event
    function triggerGlobal(settings, context, eventName, data) {
        if (settings.global) return triggerAndReturn(context || document, eventName, data)
    }

    // Number of active Ajax requests
    $.active = 0

    function ajaxStart(settings) {
        if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')
    }

    function ajaxStop(settings) {
        if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')
    }

    // triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable
    function ajaxBeforeSend(xhr, settings) {
        var context = settings.context
        if (settings.beforeSend.call(context, xhr, settings) === false ||
            triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)
            return false

        triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])
    }

    function ajaxSuccess(data, xhr, settings, deferred) {
        var context = settings.context, status = 'success'
        settings.success.call(context, data, status, xhr)
        if (deferred) deferred.resolveWith(context, [data, status, xhr])
        triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])
        ajaxComplete(status, xhr, settings)
    }

    // type: "timeout", "error", "abort", "parsererror"
    function ajaxError(error, type, xhr, settings, deferred) {
        var context = settings.context
        settings.error.call(context, xhr, type, error)
        if (deferred) deferred.rejectWith(context, [xhr, type, error])
        triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type])
        ajaxComplete(type, xhr, settings)
    }

    // status: "success", "notmodified", "error", "timeout", "abort", "parsererror"
    function ajaxComplete(status, xhr, settings) {
        var context = settings.context
        settings.complete.call(context, xhr, status)
        triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])
        ajaxStop(settings)
    }

    function ajaxDataFilter(data, type, settings) {
        if (settings.dataFilter == empty) return data
        var context = settings.context
        return settings.dataFilter.call(context, data, type)
    }

    // Empty function, used as default callback
    function empty() {
    }

    $.ajaxSettings = {
        // Default type of request
        type: 'GET',
        // Callback that is executed before request
        beforeSend: empty,
        // Callback that is executed if the request succeeds
        success: empty,
        // Callback that is executed the the server drops error
        error: empty,
        // Callback that is executed on request complete (both: error and success)
        complete: empty,
        // The context for the callbacks
        context: null,
        // Whether to trigger "global" Ajax events
        global: true,
        // Transport
        xhr: function () {
            return new window.XMLHttpRequest()
        },
        // MIME types mapping
        // IIS returns Javascript as "application/x-javascript"
        accepts: {
            script: 'text/javascript, application/javascript, application/x-javascript',
            json: jsonType,
            xml: 'application/xml, text/xml',
            html: htmlType,
            text: 'text/plain'
        },
        // Whether the request is to another domain
        crossDomain: false,
        // Default timeout
        timeout: 0,
        // Whether data should be serialized to string
        processData: true,
        // Whether the browser should be allowed to cache GET responses
        cache: true,
        //Used to handle the raw response data of XMLHttpRequest.
        //This is a pre-filtering function to sanitize the response.
        //The sanitized response should be returned
        dataFilter: empty
    }

    function mimeToDataType(mime) {
        if (mime) mime = mime.split(';', 2)[0]
        return mime && (mime == htmlType ? 'html' :
            mime == jsonType ? 'json' :
                scriptTypeRE.test(mime) ? 'script' :
                    xmlTypeRE.test(mime) && 'xml') || 'text'
    }

    function appendQuery(url, query) {
        if (query == '') return url
        return (url + '&' + query).replace(/[&?]{1,2}/, '?')
    }

    // serialize payload and append it to the URL for GET requests
    function serializeData(options) {
        if (options.processData && options.data && $.type(options.data) != "string")
            options.data = $.param(options.data, options.traditional)
        if (options.data && (!options.type || options.type.toUpperCase() == 'GET' || 'jsonp' == options.dataType))
            options.url = appendQuery(options.url, options.data), options.data = undefined
    }

    $.ajax = function (options) {
        var settings = $.extend({}, options || {}),
            deferred = $.Deferred && $.Deferred(),
            urlAnchor, hashIndex
        for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]

        ajaxStart(settings)

        if (!settings.crossDomain) {
            urlAnchor = document.createElement('a')
            urlAnchor.href = settings.url
            // cleans up URL for .href (IE only), see https://github.com/madrobby/zepto/pull/1049
            urlAnchor.href = urlAnchor.href
            settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host)
        }

        if (!settings.url) settings.url = window.location.toString()
        if ((hashIndex = settings.url.indexOf('#')) > -1) settings.url = settings.url.slice(0, hashIndex)
        serializeData(settings)

        var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url)
        if (hasPlaceholder) dataType = 'jsonp'

        if (settings.cache === false || (
            (!options || options.cache !== true) &&
            ('script' == dataType || 'jsonp' == dataType)
        ))
            settings.url = appendQuery(settings.url, '_=' + Date.now())

        var mime = settings.accepts[dataType],
            headers = {},
            setHeader = function (name, value) {
                headers[name.toLowerCase()] = [name, value]
            },
            protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol,
            xhr = settings.xhr(),
            nativeSetHeader = xhr.setRequestHeader,
            abortTimeout

        if (deferred) deferred.promise(xhr)

        if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest')
        setHeader('Accept', mime || '*/*')
        if (mime = settings.mimeType || mime) {
            if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]
            xhr.overrideMimeType && xhr.overrideMimeType(mime)
        }
        if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))
            setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded')

        if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name])
        xhr.setRequestHeader = setHeader

        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                xhr.onreadystatechange = empty
                clearTimeout(abortTimeout)
                var result, error = false
                if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {
                    dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'))

                    if (xhr.responseType == 'arraybuffer' || xhr.responseType == 'blob')
                        result = xhr.response
                    else {
                        result = xhr.responseText

                        try {
                            // http://perfectionkills.com/global-eval-what-are-the-options/
                            // sanitize response accordingly if data filter callback provided
                            result = ajaxDataFilter(result, dataType, settings)
                            if (dataType == 'script') (1, eval)(result)
                            else if (dataType == 'xml') result = xhr.responseXML
                            else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)
                        } catch (e) {
                            error = e
                        }

                        if (error) return ajaxError(error, 'parsererror', xhr, settings, deferred)
                    }

                    ajaxSuccess(result, xhr, settings, deferred)
                } else {
                    ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred)
                }
            }
        }

        if (ajaxBeforeSend(xhr, settings) === false) {
            xhr.abort()
            ajaxError(null, 'abort', xhr, settings, deferred)
            return xhr
        }

        var async = 'async' in settings ? settings.async : true
        xhr.open(settings.type, settings.url, async, settings.username, settings.password)

        if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]

        for (name in headers) nativeSetHeader.apply(xhr, headers[name])

        if (settings.timeout > 0) abortTimeout = setTimeout(function () {
            xhr.onreadystatechange = empty
            xhr.abort()
            ajaxError(null, 'timeout', xhr, settings, deferred)
        }, settings.timeout)

        // avoid sending empty string (#319)
        xhr.send(settings.data ? settings.data : null)
        return xhr
    }

    // handle optional data/success arguments
    function parseArguments(url, data, success, dataType) {
        if ($.isFunction(data)) dataType = success, success = data, data = undefined
        if (!$.isFunction(success)) dataType = success, success = undefined
        return {
            url: url
            , data: data
            , success: success
            , dataType: dataType
        }
    }

    var escape = encodeURIComponent;

    function serialize(params, obj, traditional, scope) {
        var type, array = $.isArray(obj), hash = $.isPlainObject(obj)
        $.each(obj, function (key, value) {
            type = $.type(value)
            if (scope) key = traditional ? scope :
                scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']'
            // handle data in serializeArray() format
            if (!scope && array) params.add(value.name, value.value)
            // recurse into nested objects
            else if (type == "array" || (!traditional && type == "object"))
                serialize(params, value, traditional, key)
            else params.add(key, value)
        })
    }

    $.param = function (obj, traditional) {
        var params = []
        params.add = function (key, value) {
            if ($.isFunction(value)) value = value()
            if (value == null) value = ""
            this.push(escape(key) + '=' + escape(value))
        }
        serialize(params, obj, traditional)
        return params.join('&').replace(/%20/g, '+')
    }
})(Dom7);
// layer mobile
;(function (window, $, undefined) {
    "use strict";
    var doc = document, query = 'querySelectorAll', claname = 'getElementsByClassName', S = function (s) {
        return doc[query](s);
    };

    //默认配置
    var config = {
        anim: 'scale',  //默认动画类型
        fixed: true,
        touchNo: false,
        shade: true,
        shadeClose: true,
        type: 0,//0-4 弹出层会关闭之前相同type的层，3层layer.close()是不能关闭的，单独留给缓动动画使用，比例poupon
        zIndex: -1,
    };

    var ready = {
        timer: {},
        end: {},
    };

    var index = 0, classs = ['layui-m-layer'], Layer = function (options) {
        var that = this;
        that.config = $.extend({}, config, options);
        that.view();
    };

    Layer.prototype.view = function () {
        var that = this, config = that.config, layerbox = doc.createElement('div');
        that.id = layerbox.id = classs[0] + index;
        layerbox.setAttribute('class', classs[0] + ' ' + classs[0] + (config.type || 0));
        layerbox.setAttribute('index', index);
        layerbox.setAttribute('anim', config.anim); //增加：动画名称显示
        layerbox.setAttribute('type', config.type || 0); //增加：type类型显示

        if (config.zIndex != -1) {
            layerbox.setAttribute('style', 'z-index:' + config.zIndex); //增加：最外出z-index设置
        }

        if (!config.fixed) {
            layerbox.setAttribute('style', 'position:static;');
        }

        //标题区域
        var title = (function () {
            var titype = typeof config.title === 'object';
            return config.title
                ? '<h3 style="' + (titype ? config.title[1] : '') + '">' + (titype ? config.title[0] : config.title) + '</h3>'
                : '';
        }());

        //按钮区域
        var button = (function () {
            typeof config.btn === 'string' && (config.btn = [config.btn]);
            var btns = (config.btn || []).length, btndom;
            if (btns === 0 || !config.btn) {
                return '';
            }
            btndom = '<span yes type="1">' + config.btn[0] + '</span>'
            if (btns === 2) {
                btndom = '<span no type="0">' + config.btn[1] + '</span>' + btndom;
            }
            return '<div class="layui-m-layerbtn">' + btndom + '</div>';
        }());

        if (!config.fixed) {
            // config.top = config.hasOwnProperty('top') ?  config.top : 100;
            config.style = config.style || '';
            // config.style += ' top:'+ ( doc.body.scrollTop + config.top) + 'px';
        }

        if (config.skin === 'msg') config.shade = false;

        var scrollTopHeight = doc.documentElement.scrollTop || doc.body.scrollTop;
        layerbox.innerHTML = (config.shade ? '<div ' + (typeof config.shade === 'string' ? 'style="' + config.shade + '"' : '') + ' class="layui-m-layershade"></div>' : '')
            + '<div class="layui-m-layermain" ' + (!config.fixed ? 'style="position:absolute;top:' + scrollTopHeight + 'px;"' : '') + '>'
            + '<div class="layui-m-layersection">'
            + '<div class="layui-m-layerchild ' + (config.skin ? 'layui-m-layer-' + config.skin + ' ' : '') + (config.className ? config.className : '') + ' ' + (config.anim ? 'layui-m-anim-' + config.anim : '') + '" ' + (config.style ? 'style="' + config.style + '"' : '') + '>'
            + title
            + '<div class="layui-m-layercont">' + config.content + '</div>'
            + button
            + '</div>'
            + '</div>'
            + '</div>';

        //type小于5：同type的层不能共存；type大于5：同type的层可以共存
        if (!config.type || config.type < 5) {
            var dialogs = doc[claname](classs[0] + config.type), dialen = dialogs.length;
            if (dialen >= 1) {
                layer.close(dialogs[0].getAttribute('index'));
            }
        }

        document.body.appendChild(layerbox);

        that.index = index++;
        var elem = that.elem = S('#' + that.id)[0];
        config.success && config.success(elem, that.index);

        that.action(config, elem);
    };

    Layer.prototype.action = function (config, elem) {
        var that = this;

        //当滑动弹窗内容时，禁止遮罩底部内容一起滑动
        if (config.touchNo) {
            $(".layui-m-layershade").on("touchmove", function (e) {
                e.preventDefault();
            });
            $(".layui-m-layermain").on("touchmove", function (e) {
                e.preventDefault();
            });
        }

        //自动关闭
        if (config.time) {
            ready.timer[that.index] = setTimeout(function () {
                layer.close(that.index);
            }, config.time * 1000);
        }

        //确认取消
        var btn = function () {
            var type = this.getAttribute('type');
            if (type == 0) {
                config.no && config.no();
                layer.close(that.index);
            } else {
                config.yes ? config.yes(that.index) : layer.close(that.index);
            }
        };

        if (config.btn) {
            var btns = elem[claname]('layui-m-layerbtn')[0].children, btnlen = btns.length;
            for (var ii = 0; ii < btnlen; ii++) {
                $(btns[ii]).on('click', btn);
            }
        }

        //点遮罩关闭
        if (config.shade && config.shadeClose) {
            $('.layui-m-layershade').on('click', function () {
                layer.close(that.index);
            })
        }

        config.end && (ready.end[that.index] = config.end);
    };

    window.layer = {
        v: '3.0',
        index: index,
        open: function (options) {
            var o = new Layer(options || {});
            return o.index;
        },
        close: function (index, flag) {
            //flag参数用于强制关闭多个弹出且，当有一个弹窗为type:3的，这样调用layer.closeAll()就不会一次全部关闭，这个是因为transitionend造成的
            var ibox = $('#' + classs[0] + index);
            if (ibox.lenth < 1) return;
            //增加：关闭缓动画效果
            if (!flag) {
                var animName = ibox.attr('anim');
                var _type = ibox.attr('type');
                if (_type == '3') {
                    ibox.find('.layui-m-layershade').removeClass(animName + '-shade');
                    ibox.find('.layui-m-layerchild').removeClass(animName + '-toggle').on('transitionend webkitTransitionEnd', function () {
                        ibox.remove();
                        clearTimeout(ready.timer[index]);
                        delete ready.timer[index];
                        typeof ready.end[index] === 'function' && ready.end[index]();
                        delete ready.end[index];
                    });
                } else {
                    ibox.remove();
                    clearTimeout(ready.timer[index]);
                    delete ready.timer[index];
                    typeof ready.end[index] === 'function' && ready.end[index]();
                    delete ready.end[index];
                }
            } else {
                ibox.remove();
                clearTimeout(ready.timer[index]);
                delete ready.timer[index];
                typeof ready.end[index] === 'function' && ready.end[index]();
                delete ready.end[index];
            }
        },
        closeAll: function (flag) {
            var boxs = doc[claname](classs[0]);
            for (var i = 0, len = boxs.length; i < len; i++) {
                layer.close((boxs[0].getAttribute('index') | 0), flag);
            }
        },
        msg: function (opt) {
            var defaults = {
                anim: 'up',
                direct: 'middle',
                msg: '操作成功',
                shade: false,
                shadeClose: false,
                time: 1.5,
                type: 1,
            };
            var opts = {};
            if (typeof opt === 'string') {
                opts.msg = opt;
            } else {
                opts = opt;
            }
            var config = $.extend({}, defaults, opts);
            var html, className, style = '';
            if (config.direct === 'middle') {
                className = 'weui-toast-msg';
                style = '';
                html = '<span class="weui-tmsg">' + config.msg + '</span>';
            } else if (config.direct === 'bottom') {
                className = 'weui-toast-msg weui-bottom';
                html = '<span class="weui-tmsg">' + config.msg + '</span>';
            }
            style += ' ' + config.style;
            layer.open({
                anim: config.anim,
                className: className,
                content: html,
                style: style,
                shade: config.shade,
                shadeClose: config.shadeClose,
                type: config.type,
                time: config.time,
            });
        },
        alert: function (opt) {
            var defaults = {
                title: null,
                msg: '',
                className: '',
                style: 'width: 80%;max-width: 300px;',
                skin: 'weui-dialog',
                shade: true,
                shadeClose: false,
                type: 1, //防止和loading()冲突
                touchNo: true,
                zIndex: -1,
                btn: ['确定'],
                onOK: function (i) {
                    layer.close(i);
                },
                onCancel: function (i) {
                    layer.close(i);
                },
            };
            var opts = {};
            if (typeof opt === 'string') {
                opts.msg = opt;
            } else {
                opts = opt;
            }
            var config = $.extend({}, defaults, opts);
            var html = '<div class="' + (config.skin + '_bd') + '">' + config.msg + '</div>';
            layer.open({
                title: config.title,
                content: html,
                className: config.title ? config.className : config.className + ' title-no',
                style: config.style,
                skin: config.skin,
                shade: config.shade,
                shadeClose: config.shadeClose,
                type: config.type,
                touchNo: config.touchNo,
                zIndex: config.zIndex,
                btn: config.btn,
                yes: config.onOK,
                no: config.onCancel,
            });
        },
        confirm: function (opt) {
            var defaults = {
                title: '',
                msg: '',
                style: 'width: 80%;max-width: 300px;',
                skin: 'weui-dialog',
                shade: true,
                shadeClose: false,
                type: 1, //防止和loading()冲突
                touchNo: true,
                btn: ['确定', '取消'],
                onOK: function (i) {
                    layer.close(i);
                },
                onCancel: function (i) {
                    layer.close(i);
                },
            };
            var config = $.extend({}, defaults, opt);
            var html = '<div class="' + (config.skin + '_bd') + '">' + config.msg + '</div>';
            layer.open({
                title: config.title,
                content: html,
                className: config.title ? '' : 'title-no',
                style: config.style,
                skin: config.skin,
                shade: config.shade,
                shadeClose: config.shadeClose,
                type: config.type,
                touchNo: config.touchNo,
                btn: config.btn,
                yes: config.onOK,
                no: config.onCancel,
            });
        },
        loading: function (opt) {
            var defaults = {
                className: 'weui-toast',
                msg: '数据加载中',
                type: 0,
                shade: 'background-color: rgba(0,0,0,0);',
                shadeClose: false,
                touchNo: true,
            };
            var opts = {};
            if (typeof opt === 'string') {
                opts.msg = opt;
            } else {
                opts = opt;
            }
            var config = $.extend({}, defaults, opts);
            var html = '';
            html += '<i class="weui-loading weui-icon_toast"></i>';
            html += '<p class="weui-toast__content">' + config.msg + '</p>';
            return layer.open({
                className: config.className,
                content: html,
                type: config.type,
                shade: config.shade,
                shadeClose: config.shadeClose,
                touchNo: config.touchNo,
            });
        },
        toast: function (opt) {
            var defaults = {
                className: 'weui-toast',
                msg: '',
                shade: 'background-color: rgba(0,0,0,0);',
                shadeClose: false,
                skin: 'success',
                time: 2,
                touchNo: true,
                callback: null,
            };
            var opts = {};
            if (typeof opt === 'string') {
                opts.msg = opt;
            } else {
                opts = opt;
            }
            var config = $.extend({}, defaults, opts);
            var skinMsg = config.skin === 'success' ? '操作成功' : '操作失败';
            var classIco;
            switch (config.skin) {
                case 'success':
                    classIco = 'weui-icon-success-no-circle';
                    break;
                case 'error':
                    classIco = 'weui-icon-cancel';
                    break;
                default:
                    classIco = 'weui-icon-success-no-circle';
                    break;
            }
            var html = '';
            html += '<i class="' + classIco + ' weui-icon_toast"></i>';
            html += '<p class="weui-toast__content">' + (config.msg ? config.msg : skinMsg) + '</p>';
            layer.open({
                className: config.className,
                content: html,
                shade: config.shade,
                shadeClose: config.shadeClose,
                time: config.time,
                touchNo: config.touchNo,
                end: function () {
                    if ($.isFunction(config.callback)) {
                        config.callback.call(this);
                    }
                }
            });
        },
        popupUp: function (opt) {
            //popupUp是由底部弹出的弹窗，带有缓动动画弹出和隐藏。
            var defaults = {
                anim: 'weui-actionsheet',
                className: '',
                content: '',
                shade: 'background-color: rgb(0, 0, 0);opacity: 0;transition: all .3s;-webkit-transition: all .3s;',
                shadeClose: true,
                style: '',
                touchNo: false,
                zIndex: -1,
                success: null,
                end: null,
            };
            var options = $.extend({}, defaults, opt);
            var className = options.className ? (options.anim + ' ' + options.className) : options.anim;
            layer.open({
                anim: options.anim,
                className: className,
                content: options.content,
                shade: options.shade,
                shadeClose: options.shadeClose,
                style: options.style,
                type: 3,
                touchNo: options.touchNo,
                zIndex: options.zIndex,
                success: function (el, index) {
                    $('.' + options.anim).width();//强制取值一次，防止上下代码合并执行，否则动画效果无效
                    $('.' + options.anim).addClass(options.anim + '-toggle');

                    $('.layui-m-layershade').width();//强制取值一次，防止上下代码合并执行，否则动画效果无效
                    $('.layui-m-layershade').addClass(options.anim + '-shade');

                    if ($.isFunction(options.success)) {
                        options.success.apply(this, [el, index]);
                    }
                },
                end: function () {
                    if ($.isFunction(options.end)) {
                        options.end.call();
                    }
                }
            });
        },
        popupDown: function (option) {
            //popupDown是由顶部弹出的弹窗，可选带有缓动动画弹出和隐藏。
            var defaults = {
                anim: 'weui-actionsheet-top',
                className: '',
                content: '',
                shade: 'opacity: 0;background-color: rgb(0, 0, 0);transition: all .3s;-webkit-transition: all .3s;',
                shadeClose: true,
                style: '',
                zIndex: -1,
                success: null,
                end: null,
            };
            var options = $.extend({}, defaults, option);
            var className = options.className ? (options.anim + ' ' + options.className) : options.anim;
            layer.open({
                anim: options.anim,
                content: options.content,
                className: className,
                shade: options.shade,
                shadeClose: options.shadeClose,
                style: options.style,
                type: 3,
                zIndex: options.zIndex,
                success: function (el, index) {
                    $('.' + options.anim).width();//强制取值一次，防止上下代码合并执行，否则动画效果无效
                    $('.' + options.anim).addClass(options.anim + '-toggle');

                    $('.layui-m-layershade').width();//强制取值一次，防止上下代码合并执行，否则动画效果无效
                    $('.layui-m-layershade').addClass(options.anim + '-shade');

                    if ($.isFunction(options.success)) {
                        options.success.apply(this, [el, index]);
                    }
                },
                end: function () {
                    if ($.isFunction(options.end)) {
                        options.success.call(this);
                    }
                }
            });
        },
        actions: function (opt) {
            var defaults = {
                cancleText: '取消',
                style: 'background-color:#efeff4;',
                styleTitle: '',
                title: '',
                touchNo: true,
                zIndex: -1,
                actions: [{
                    text: '操作2',
                    style: '',
                    onClick: null,
                }],
            };
            var options = $.extend({}, defaults, opt);
            var html = '';
            if (options.title) {
                html += '<div class="weui-actionsheet-title" style="' + options.styleTitle + '">' + options.title + '</div>';
            }
            html += '<ul class="menu-list">';
            $.each(options.actions, function (index, item) {
                html += '<li style="' + item.style + '">' + item.text + '</li>';
            })
            html += '</ul>';
            html += '<p class="btn-cancle">' + options.cancleText + '</p>';
            layer.popupUp({
                content: html,
                style: options.style,
                touchNo: options.touchNo,
                zIndex: options.zIndex,
                success: function (el, index) {
                    $('.weui-actionsheet .menu-list li').each(function (index) {
                        var onClick = options.actions[index].onClick;
                        if ($.isFunction(onClick)) {
                            $(this).on('click', onClick);
                        }
                    });

                    $('.weui-actionsheet .btn-cancle').on('click', function () {
                        layer.close(index);
                    });

                    // $(".layui-m-layershade").on("touchmove", function (e) {
                    //     e.preventDefault();
                    // });
                    // $('.layui-m-layermain').on('touchmove', function (e) {
                    //     e.preventDefault();
                    // });
                }
            });
        },
        photoLayer: function (opt) {
            var defaults = {
                btnClose: false,
                className: '',
                classNameDefault: 'photo-layer',
                shade: true,
                shadeClose: true,
                style: 'width:90%;max-width:640px;background-color:transparent;',
                items: [
                    // {
                    //     'img':'',
                    //     'className':null,
                    //     'link':null,
                    // },
                    //img:'',//支持string,此时为img路径
                ],
                success: null,
            };
            var options = $.extend({}, defaults, opt);
            var html = '<div class="' + options.classNameDefault + ' ' + options.className + '">';
            if (options.items.length > 0) {
                html += '<ul>';
                for (var i = 0; i < options.items.length; i++) {
                    if (typeof options.items[i] === 'string') {
                        html += '<li><img src="' + options.items[i] + '" width="100%" /></li>';
                    } else if (typeof options.items[i] === 'object' && Object.prototype.toString.call(options.items[i]) === '[object Object]') {
                        if (options.items[i].img) {
                            if (options.items[i].link) {
                                html += '<li class="' + (options.items[i].className ? options.items[i].className : '') + '"><a href="' + options.items[i].link + '"><img src="' + options.items[i].img + '" width="100%" /></a></li>';
                            } else {
                                html += '<li class="' + (options.items[i].className ? options.items[i].className : '') + '"><img src="' + options.items[i].img + '" width="100%" /></li>';
                            }
                        }
                    }
                }
                html += '</ul>';
                if (options.btnClose) {
                    html += '<span class="layer-close"><i class="weui-icon-cancel"></i></span>';
                }
            }
            html += '</div>';
            var className = options.className ? options.classNameDefault + '-wrap ' + options.className + '-wrap' : options.classNameDefault + '-wrap';
            return layer.open({
                type: 1,
                shade: options.shade,
                shadeClose: options.shadeClose,
                style: options.style,
                className: className,
                content: html,
                success: function (el, index) {
                    var $close = $('.' + options.classNameDefault + '-wrap .close,' + '.' + options.classNameDefault + '-wrap .layer-close');
                    $close.on('click', function () {
                        layer.close(index);
                        return false;
                    })

                    if ($.isFunction(options.success)) {
                        options.success.apply(this, null);
                    }
                }
            });
        },
    };

    'function' == typeof define ? define(function () {
        return layer;
    }) : function () {
        var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
        var path = jsPath.substring(0, jsPath.lastIndexOf("/") + 1);

        //如果合并方式，则需要单独引入layer.css
        if (script.getAttribute('merge')) return;

        document.head.appendChild(function () {
            var link = doc.createElement('link');
            link.href = path + 'need/layer.min.css';
            link.type = 'text/css';
            link.rel = 'styleSheet';
            link.id = 'layermcss';
            return link;
        }());
    }();
})(window, Dom7);
